import java.util.ArrayList;
import java.util.Collections;

public class QIta {
    public static void main(String[] args){
        //创建集合
        ArrayList<String> list=new ArrayList<>();
        //2.添加数据
        Collections.addAll(list,"张无忌","周至柔","张三丰","张强");
        //过滤数据
        list.stream().filter(s->s.startsWith("张")).filter(s->s.length()==3).forEach(s-> System.out.println(s));
        //引用其他类别
        list.stream().filter(new StringOperation()::stringJudge)
                .forEach(s-> System.out.println(s));
        //如果是本类别
        //由于静态方法中不能有this
        //所以要new一个本类的对象
        list.stream().filter(new QIta()::stringJudge)
                .forEach(s-> System.out.println(s));

    }
    public boolean stringJudge(String s){
        return s.startsWith("张") && s.length()==3;
    }
}
